From: Kai Großjohann Date: Sun, 13 Jun 2004 16:48:44 +0000 (+0000) Subject: (diff-current-defun): If at start of hunk, use X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~22004 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=593d886a3ee4fc35378ca5d39d5bf38d1e3f75d8;p=emacs.git (diff-current-defun): If at start of hunk, use position of first change. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 10376008292..b810f87a565 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2004-06-13 Kai Grossjohann + + * diff-mode.el (diff-current-defun): If at start of hunk, use + position of first change. + 2004-06-13 Lars Hansen * dired-x.el (dired-mark-omitted): Bind to "*O". diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 9b00eae050d..3e6d1b7ac57 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -1248,9 +1248,12 @@ If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[u (defun diff-current-defun () "Find the name of function at point. For use in `add-log-current-defun-function'." + (save-excursion + (when (looking-at diff-hunk-header-re) + (forward-line 1) + (while (and (looking-at " ") (not (zerop (forward-line 1)))))) (destructuring-bind (buf line-offset pos src dst &optional switched) (diff-find-source-location) - (save-excursion (beginning-of-line) (or (when (memq (char-after) '(?< ?-)) ;; Cursor is pointing at removed text. This could be a removed